local skel = fk.CreateSkill {
  name = "rmt__shiji",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["rmt__shiji"] = "势羁",
  [":rmt__shiji"] = "锁定技，当前回合角色使用牌指定除其外的角色为目标后，若你本回合此前成为过牌的目标，此牌不可以被响应；否则此牌对你无效。",

  ["$rmt__shiji1"] = "朕虽不能登辇拔剑，又岂能坐受此辱！",
  ["$rmt__shiji2"] = "手执断笛吟呕哑，难引凤凰来栖...",
}

skel:addEffect(fk.TargetSpecified, {
  anim_type = "defensive",
  mute = true,
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and target and target.phase ~= Player.NotActive and data.firstTarget then
      return table.find(data.use.tos, function (p)
        return p ~= target
      end)
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:doIndicate(player, {target})
    local parentUseEvent = room.logic:getCurrentEvent():findParent(GameEvent.UseCard)
    if parentUseEvent == nil then return end
    if #room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
      local use = e.data
      return use.tos and table.contains(use.tos, player) and e.id < parentUseEvent.id
    end, Player.HistoryTurn) > 0 then
      player:broadcastSkillInvoke(self.name, 2)
      room:notifySkillInvoked(player, self.name, "negative", {target})
      data.use.disresponsiveList = table.simpleClone(room.players)
      data.disresponsive = true
    else
      player:broadcastSkillInvoke(self.name, 1)
      room:notifySkillInvoked(player, self.name, "defensive", {target})
      data:setNullified(player)
      if data.to == player and (data.card.sub_type == Card.SubtypeDelayedTrick or data.card.type == Card.TypeEquip) then
        --注意，不能取消目标，会导致记录器认为你没成为过目标……
        local trick = room:getSubcardsByRule(data.card, {Card.Processing})
        if #trick > 0 then
          room:moveCardTo(trick, Card.DiscardPile, nil, fk.ReasonUse)
        end
      end
    end
  end,
})

return skel
